package cn.kgc.spring.entity;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * @author: mosin
 * @version: v1.0  2022/7/1
 */
@Component
public class Student implements InitializingBean, DisposableBean {

    private String stuName;
    private  Integer age;


    public  Student(){

        System.out.println("Student()");

    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        System.out.println("setStuName()");
        this.stuName = stuName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        System.out.println("setAge()");
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuName='" + stuName + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("interface destroy() ");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("interface afterPropertiesSet() ");
    }

    // 自定义对象初始化方法
    public  void  init(){

        System.out.println(" init()");

    }


    // 自定义对象销毁方法
    public  void  destroy2(){

        System.out.println("destroy()");

    }
}
